﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YJTMedicalAideManage.Cores;
using YJTMedicalAideManage.Cores.Events;
using YJTMedicalAideManage.Cores.Models;

namespace YJTMedicalAideManage.MAM.Model
{
    public class AreaInfo : InheritBase
    {
        private bool isbool = false;
        public AreaInfo()
        {
            StatusMamEvent.Instance.Subscribe(status);
        }
        private void status(string s)
        {
            if (s == "编辑")
            {
                isbool = true;
            }
            else
            {
                isbool = false;
            }
        }
        private adddress _province;

        public adddress Province
        {
            get => _province;
            set
            {
                if (isbool == true && _province == null)
                {

                }
                else
                {
                    AddDressEvent.Instance.PushMessage(value);
                    AddDressEvent.Instance.PushMessages(value);
                    isbool = false;
                }
                _province = value;
                RaisePropertyChanged();
            }
        }

        private adddress _city;

        public adddress City
        {
            get => _city;
            set
            {
                if (isbool == true && _city == null)
                {
                   
                }
                else
                {
                    AddDressEvent.Instance.PushMessages(value);
                    isbool = false;
                }
                
                _city = value;
                RaisePropertyChanged();
            }
        }

        private adddress _area;

        public adddress Area
        {
            get => _area;
            set
            {
                _area = value;
                RaisePropertyChanged();
            }
        }

        private string live_address;

        public string Live_address
        {
            get => live_address;
            set
            {
                live_address = value;
                RaisePropertyChanged();
            }
        }
    }
}
